package action.league;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import model.dao.LeagueModel;
import model.dto.League;
import controller.Action;
import controller.ActionForward;

public class ActionGetLeague implements Action {

	@Override
	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		
		League dto=null;
		LeagueModel dao=new LeagueModel();
		
		int league_id=Integer.parseInt(request.getParameter("id"));
		int page=Integer.parseInt(request.getParameter("page"));
		
		System.out.println("page="+page+"  id="+league_id);
		dto=dao.get(league_id);
		request.setAttribute("dto", dto);
		request.setAttribute("page", page);
		
		ActionForward forward=new ActionForward();
		forward.setPath("add-league.sp");
		forward.setRedirect(false);
		return forward;
	}

}
